import 'dart:async';
import 'dart:math';

import 'package:projectfluttershengyihuatong/category/catetory_controller.dart';
import 'package:projectfluttershengyihuatong/service/jsontool.dart';
import 'package:projectfluttershengyihuatong/service/request_manager.dart';
import 'package:projectfluttershengyihuatong/tab1/HomeModel.dart';

class HomeViewModel {
  request() {
    CatetoryController.getInstance().getSaveCatetory().then((value){
      final pid =
          CatetoryController.getInstance().leiModel?.pid;
      return RequestManager.getInstance().dio.get(
          "/api/config/getLeiHomePageData",
          queryParameters: {"lei_id": pid});
    }).then((response){
      final baseModel = BaseModel<HomeModel>.fromJson(response.data);
      model = baseModel.data;
      streamController.add(model);
    }).onError((error, stackTrace) {

    });

  }
  HomeModel? model = HomeModel();
  StreamController<HomeModel?> streamController = StreamController<HomeModel?>();

}
